<template>
  <div class="view">
    <!-- 空状态 -->
    <van-empty
      v-if="changeSort"
      image="https://cdn.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
      image-size="80"
      description="空空如也"
    />
    <!-- 分类商品信息 -->
    <div class="items" v-else>
      <scroller>
        <div class="item" v-for="item in goodsList" :key="item.id">
          <img :src="item.url" v-lazy="item.url" />
          <div class="itemContent">
            <div class="goodsName">
              <div class="name">{{item.name}}</div>
              <div class="goodsOld">已售{{item.old}}</div>
            </div>
            <div class="goodsPrice">
              <div class="price">{{item.price}}</div>
              <van-icon name="cart" />
            </div>
          </div>
        </div>
      </scroller>
    </div>
  </div>
</template>

<script>
export default {
  name: 'YscShopView',
  props: ['goodsList', 'changeSort'],
  data () {
    return {
      slideBar: []
    };
  },

  mounted () {
  },
  computed: {

  },
  methods: {

  },
};
</script>

<style lang="less" scoped>
.view {
  width: 78.7%;
  height: 75%;
  position: absolute;
  right: 0px;
  top: 0px;
  background-color: #fff;
  .item {
    width: 100%;
    height: 90px;
    display: flex;
    justify-content: space-between;
    padding: 0px 10px;
    box-sizing: border-box;
    align-items: center;
    .goodsName {
      .name {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
      .goodsOld {
        color: #a6a5a5;
        font-size: 12px;
      }
    }
    img {
      width: 100px;
      height: 90px;
      border-radius: 5px;
    }
    .itemContent {
      font-size: 14px;
      width: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      padding: 0px 15px;
      box-sizing: border-box;
      .goodsPrice {
        display: flex;
        justify-content: space-between;
        color: #f96c2f;
        align-items: center;
        .price {
          font-size: 14px;
          font-weight: bold;
        }
        .price::before {
          content: "¥";
          margin-right: 3px;
          font-size: 14px;
        }
        .van-icon {
          font-size: 18px;
        }
      }
    }
  }
  .item:nth-child(n + 2) {
    margin-top: 10px;
  }
}
</style>